package cn.seaboot.admin.api.service;

import cn.seaboot.admin.api.bean.ApiModel;
import cn.seaboot.admin.api.dao.ApiModelDao;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Service
 * 对象模型 [t_api_model]
 *
 * @author Mr.css on 2018-6-20
 */
@Service
public class ApiModelService {

    @Resource
    private ApiModelDao apiModelDao;

    /**
     * 增
     *
     * @param pojo pojo
     * @return affected rows
     */
    public int insert(ApiModel pojo) {
        return apiModelDao.insert(pojo);
    }

    /**
     * 删
     *
     * @param projectId 工程ID
     * @param className 对象名
     * @return affected rows
     */
    public int deleteById(String projectId, String className) {
        return apiModelDao.deleteById(projectId, className);
    }

    /**
     * 删
     *
     * @param projectId 工程ID
     * @return affected rows
     */
    public int deleteByProjectId(String projectId) {
        return apiModelDao.deleteByProjectId(projectId);
    }

    /**
     * 改
     *
     * @param pojo pojo
     * @return affected rows
     */
    public int updateById(ApiModel pojo) {
        return apiModelDao.updateSampleById(pojo);
    }

    /**
     * 查
     *
     * @param projectId 工程ID
     * @param className 对象名
     * @return pojo
     */
    public ApiModel queryById(String projectId, String className) {
        return apiModelDao.selectById(projectId, className);
    }

    /**
     * 查列表
     *
     * @param projectId 工程ID
     * @return list
     */
    public List<ApiModel> queryList(String projectId) {
        return apiModelDao.selectList(projectId);
    }
}
